package io.github.talelin.latticy.laver.service.impl;

import io.github.talelin.latticy.model.BannerDO;
import io.github.talelin.latticy.mapper.BannerMapper;
import io.github.talelin.latticy.laver.service.TestSleeveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName TestSleeveServiceImpl
 * @Description TODO
 * @Author wushaopei
 * @Date 2021/10/17 14:22
 * @Version 1.0
 */
@Service
public class TestSleeveServiceImpl implements TestSleeveService {

    @Autowired
    private BannerMapper bannerMapper;

    @Override
    public List<BannerDO> getBanners() {
        return bannerMapper.getAllBanners();
    }

    @Override
    public long insertBanner() {
        BannerDO bannerDO = new BannerDO();
        bannerDO.setName("NewBanner");
        bannerDO.setTitle("NewBannerTitle");

        bannerMapper.insertBanner(bannerDO);
        return bannerDO.getId();
    }
}
